/**
 * @description 罗马数字转整数（游卡前端笔试的时候出现过）
 * @param {string} s
 * @return {number}
 */
var romanToInt = function (s) {
    var obj = {
        "I": 1,
        "V": 5,
        "X": 10,
        "L": 50,
        "C": 100,
        "D": 500,
        "M": 1000
    }
    var arr = s.split("");
    var sum = 0;
    for (var i = 0; i < arr.length; i++) {
        if (obj[arr[i]] >= (i == (arr.length - 1) ? obj[arr[i]] : obj[arr[i + 1]])) {
            for (const key in obj) {
                if (arr[i] == key) {
                    sum += obj[key];
                }
            }
        } else {
            for (const key in obj) {
                if (arr[i] == key) {
                    sum -= obj[key];
                }
            }
        }
    }
    return sum;
};